

<%@ page import="org.tailor.Regions"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="mainlayout" />
<g:set var="entityName"
	value="${message(code: 'regions.label', default: 'Regions')}" />
<title><g:message code="default.edit.label" args="[entityName]" />
</title>
</head>
<body>

	<div class="col_middle">
		<h1>
			<g:message code="default.edit.label" args="[entityName]" />
		</h1>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
		<g:hasErrors bean="${regionsInstance}">
			<div class="errors">
				<g:renderErrors bean="${regionsInstance}" as="list" />
			</div>
		</g:hasErrors>
		<g:form method="post" action="save" controller="regions" enctype="multipart/form-data">
			<g:hiddenField name="id" value="${regionsInstance?.id}" />
			<g:hiddenField name="version" value="${regionsInstance?.version}" />
			<div class="dialog">
				<table>
					<tbody>

						<tr class="prop">
							<td valign="top" class="name"><label for="regionID"><g:message
										code="regions.regionID.label" default="Region ID" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: regionsInstance, field: 'regionID', 'errors')}">
								<g:textField name="regionID"
									value="${fieldValue(bean: regionsInstance, field: 'regionID')}" />
								<br /> <br />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="regionName"><g:message
										code="regions.regionName.label" default="Region Name" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: regionsInstance, field: 'regionName', 'errors')}">
								<g:textField name="regionName"
									value="${regionsInstance?.regionName}" /> <br /> <br />
							</td>
						</tr>

                         <tr class="prop">
								<td valign="top" class="name"><g:message
										code="regions.regionPicture.label" default="Region Picture" />
								</td>

								<td valign="top" class="value"><img
									src="<g:createLink controller='regions' action='renderImage' id='${fieldValue(bean: regionsInstance, field:"id")}'/>"
									width="120" height="120"
									title="${fieldValue(bean: regionsInstance, field:"id")}"
									alt="No Photo" /></td>

							</tr>
							<tr>
								<td></td>
								<td valign="top"
									class="value ${hasErrors(bean: regionsInstance, field: 'regionPicture', 'errors')}">
									<input type="file" name="regionPicture" id="regionPicture"
									size="10" /> <br />
								<br /></td>
							</tr>


						<tr class="prop">
							<td valign="top" class="name"><label for="description"><g:message
										code="regions.description.label" default="Description" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: regionsInstance, field: 'description', 'errors')}">
								<g:textField name="description"
									value="${regionsInstance?.description}" /> <br />
							<br /></td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="tailor"><g:message
										code="regions.tailor.label" default="Tailor" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: regionsInstance, field: 'tailor', 'errors')}">


								<g:each in="${regionsInstance?.tailor?}" var="t">
									<g:link controller="tailor" action="show" id="${t.id}">
										${t?.encodeAsHTML()}
									</g:link>
                                        <br/><br/>
								</g:each> <g:link controller="tailor" action="create"
									params="['regions.id': regionsInstance?.id]">
									${message(code: 'default.add.label', args: [message(code: 'tailor.label', default: 'Tailor')])}
								</g:link> <br />
							<br /></td>
						</tr>

					</tbody>
				</table>
			</div>
			<div class="buttons">
				<span class="button"><g:actionSubmit class="save"
						action="update"
						value="${message(code: 'default.button.update.label', default: 'Update')}" />
				</span> <span class="button"><g:actionSubmit class="delete"
						action="delete"
						value="${message(code: 'default.button.delete.label', default: 'Delete')}"
						onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
				</span>
			</div>
		</g:form>
	</div>
</body>
</html>
